// $codepro.audit.disable
package edu.gatech.oad.records;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import edu.gatech.oad.schedule.Appointment;
import junit.framework.TestCase;

public class InvoiceTest extends TestCase {

	private List<String> testList = new ArrayList<String>();
	/**
	 * Tests the creation of a Invoice
	 */
	public void testCreateInvoice()
	{
		testList.add("Test Appointment");
		Appointment curAppointment = new Appointment(new Date(), testList);
		TreatmentRecord curRecord = new TreatmentRecord(curAppointment);
		Invoice curInvoice = new Invoice(curRecord);
		curRecord.setInvoice(curInvoice);
		assertEquals(curInvoice, curRecord.getInvoice());//check that the Invoice field in the TreatmentRecord is updated
	}
	
	/**
	 * Tests editing a Invoice
	 */
	public void testEditInvoice()
	{
		testList.add("Test Appointment");
		Appointment curAppointment = new Appointment(new Date(), testList);
		TreatmentRecord curRecord = new TreatmentRecord(curAppointment);
		Invoice curInvoice = new Invoice(curRecord);
		curInvoice.setIsPaid(true);
		assertTrue(curInvoice.equalIsPaid());
		curInvoice.setIsPaid(false);
		assertFalse(curInvoice.equalIsPaid());//check that the isPaid field is updated
	}
	
	/**
	 * Tests the removal of a Invoice from the TreatmentRecord
	 */
	public void testDeleteInvoice()
	{
		testList.add("Test Appointment");
		Appointment curAppointment = new Appointment(new Date(), testList);
		TreatmentRecord curRecord = new TreatmentRecord(curAppointment);
		Invoice curInvoice = new Invoice(curRecord);
		curRecord.setInvoice(curInvoice);
		assertEquals(curInvoice, curRecord.getInvoice());//check that field in TreatmentRecord has been set
		curRecord.setInvoice(null);
		assertEquals(null, curRecord.getInvoice());//check that the Invoice has been removed from the TreatmentRecord
	}
}
